package com.xc.hotelmgr.webapi.modules.ht.service.impl;

import com.xc.hotelmgr.webapi.common.utils.DateUtils;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xc.hotelmgr.webapi.common.utils.PageUtils;
import com.xc.hotelmgr.webapi.common.utils.Query;

import com.xc.hotelmgr.webapi.modules.ht.dao.HtDailyroomDao;
import com.xc.hotelmgr.webapi.modules.ht.entity.HtDailyroomEntity;
import com.xc.hotelmgr.webapi.modules.ht.service.HtDailyroomService;


@Service("htDailyroomService")
public class HtDailyroomServiceImpl extends ServiceImpl<HtDailyroomDao, HtDailyroomEntity> implements HtDailyroomService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Object rpCode = params.get("rpCode");
        IPage<HtDailyroomEntity> page = this.page(
                new Query<HtDailyroomEntity>().getPage(params),
                new QueryWrapper<HtDailyroomEntity>().eq(rpCode !=null,"rp_code",rpCode)
        );

        return new PageUtils(page);
    }

    @Override
    public void delExpirePrice() {
        String expireDate = DateUtils.format(new Date());
        baseMapper.delExpirePrice(expireDate);
    }

}